package net
{
	public class AMFException
	{
		public var code:String;
		public var description:String; // pass the description    
		public var details:String; // pass the details
		public var level:String; 
		public var line:uint; // pass the line number
		private static const PARAMETERS:Array = ["code","description","details","level","line"];
		public function AMFException()
		{
		}
		public function toString():String{
			var result:String = "";
			var p:String;
			for each(p in PARAMETERS){
				result += p+" : "+this[p]+"\n";
			}
			return result;
		}
		public static function fromObject(value:Object):AMFException{
			var p:String;
			var result:AMFException = new AMFException;
			for each(p in PARAMETERS){
				if(! value.hasOwnProperty(p)){
					throw new Error("Invalid object");
					return null;
				}
				result[p] = value[p];	
			}
			return result;
		}
	}
}